package com.yq.ylmall.result;

import lombok.Getter;

/**
 * 统一返回结果状态信息类
 *
 */
@Getter // 提供获取属性值的getter方法
public enum ResultCode {

    SUCCESS(200,"成功"),
    OPERATE_SUCCESS(203,"操作成功"),
    FAIL(201, "失败"),
    SERVICE_ERROR(2012, "服务异常"),
    DATA_ERROR(204, "非法参数"),
    ILLEGAL_REQUEST(205, "非法请求"),
    REPEAT_SUBMIT(206, "重复提交"),

    LOGIN_AUTH(208, "未登陆"),
    PERMISSION(209, "没有权限"),

    ORDER_PRICE_ERROR(210, "订单商品价格变化"),
    ORDER_STOCK_FALL(204, "订单库存锁定失败"),
    CREATE_ORDER_FAIL(210, "创建订单失败"),

    COUPON_GET(220, "优惠券已经领取"),
    COUPON_LIMIT_GET(221, "优惠券已发放完毕"),

    URL_ENCODE_ERROR( 216, "URL编码失败"),
    ILLEGAL_CALLBACK_REQUEST_ERROR( 217, "非法回调请求"),
    FETCH_ACCESSTOKEN_FAILD( 218, "获取accessToken失败"),
    FETCH_USERINFO_ERROR( 219, "获取用户信息失败"),

    INCORRECT_USERNAME_OR_PASSWORD( 225, "用户名或者密码错误"),
    THE_USERNAME_HAS_BEEN_REGISTERED( 226, "用户名已经被注册"),
    USER_REGISTRATION_FAILED( 227, "用户注册失败"),
    USER_MODIFICATION_FAILED( 228, "用户修改失败"),
    VALIDATECODE_ERROR( 229, "验证码错误"),

    SAVE_SUCCESS(250,"保存成功"),
    UPDATE_SUCCESS(251,"更新成功"),
    DELETE_SUCCESS(252,"删除成功"),
    SAVE_FAIL(253,"保存失败"),
    UPDATE_FAIL(254,"更新失败"),
    DELETE_FAIL(255,"删除失败"),

    CHECK_SUCCESS(260,"审核成功"),

    SKU_LIMIT_ERROR(230, "购买个数不能大于限购个数"),
    REGION_OPEN(241, "该区域已开通"),
    REGION_NO_OPEN(240, "该区域未开通"),
    ILLEGAL_TOKEN(401,"非法的token"),

    ILLEGAL_STRING(300, "非法字符串!"),
    NODE_ERROR(421,"当前节点下面还有子节点"),

    SERVER_ERROR(500,"服务器异常，请联系管理员处理"),
    FILE_UPLOAD_FAIL(501,"文件上传失败"),
    FILE_DOWNLOAD_FAIL(502,"文件下载失败"),
    THE_COUPON_DOES_NOT_EXIST(1000,"优惠卷不存在"),
    DISCOUNT_COUPON_STATUS_ERROR(1001,"只有待发放和暂停中的优惠卷才能发放"),
    INVALID_REDEMPTION_CODE(1002,"无效兑换码"),
    COUPON_CODE_PATTERN(1003,"优惠卷兑换码模式")
    ;

    private Integer code;

    private String message;

    private ResultCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
}
